import axios from "axios";
import {config} from "@/config";

axios.defaults.baseURL=config.baseURL;



export const register = (data)=>{
    return axios.post('/api/register',data);
}

export const login = (data) => {
    return axios.post('/api/login',data)
}

export const getUserInfo = () => {
    return axios.get('/api/user-info');
}

export const getTasks = (pageIndex, pageSize) => {
    return axios.get('/api/task',{params:{pageIndex,pageSize}});
}

export const getTaskDetail =  (taskId) =>{
    return axios.get(`/api/task/${taskId}`)
}

export const updateTask = (id,task)=>{
    return axios.put(`/api/task/${id}`,task)
}

export const createTask = (param) => {
    return axios.post('/api/task',param)
}